{extend name="../../base/view/common/base" /}
<!-- 主体 -->
{block name="body"}
<div class="p-3">
    <table class="layui-hide" id="test" lay-filter="test"></table>
    <input name="rszs_log_id" id="rszs_log_id" type="hidden" value="{$rszs_log_id}">
</div>

<script type="text/html" id="toolbarDemo">

</script>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
    const moduleInit = ['tool'];
    // {
    //     field: 'check_status', title: '状态', align: 'center', width: 200, templet: function (d) {
    //     var html = '<span class="layui-btn layui-btn-xs layui-bg-' + d.check_status + '">' + d.status_name + '</span>';
    //     return html;
    // }
    // },
    function gouguInit() {
        var rszs_log_id = $("#rszs_log_id").val();
        var table = layui.table, tool = layui.tool, form = layui.form;
        layui.pageTable = table.render({
            elem: '#test',
            title: '参保明细',
            toolbar: '#toolbarDemo',
            defaultToolbar: ['filter', {title: '导出EXCEL', layEvent: 'LAYTABLE_EXCEL', icon: 'layui-icon-export'}],
            url: "/rszs/rszs/detail?rszs_log_id="+rszs_log_id, //数据接口
            cellMinWidth: 80,
            page: true, //开启分页
            limit: 20,
            cols: [
                [ //表头
                    {
                        field: 'id',
                        title: '编号',
                        align: 'center',
                        width: 80
                    }, {
                    field: 'name',
                    title: '姓名',
                    width: 150
                }, {
                    field: 'idcard',
                    title: '身份证号',
                    align: 'center',
                    width: 200
                }, {
                    field: 'company',
                    title: '单位名称',
                    align: 'center',
                    width: 200
                }, {
                    field: 'code',
                    title: '社保编号',
                    align: 'center',
                    width: 200
                }, {
                    field: 'sex',
                    title: '性别',
                    align: 'center',
                    width: 200
                }, {
                    field: 'sybx_insured_date',
                    title: '失业保险参保时间',
                    align: 'center',
                    width: 200
                }, {
                    field: 'sybx_insured_yj_month',
                    title: '失业保险应缴月份',
                    align: 'center',
                    width: 200
                }, {
                    field: 'sybx_insured_sj_month',
                    title: '失业保险实缴月份',
                    align: 'center',
                    width: 200
                }, {
                    field: 'sybx_insured_qf_month',
                    title: '失业保险欠费月份',
                    align: 'center',
                    width: 200
                }, , {
                    field: 'gsbx_insured_date',
                    title: '工伤保险参保时间',
                    align: 'center',
                    width: 200
                }, {
                    field: 'gsbx_insured_yj_month',
                    title: '工伤保险应缴月份',
                    align: 'center',
                    width: 200
                }, {
                    field: 'gsbx_insured_sj_month',
                    title: '工伤保险实缴月份',
                    align: 'center',
                    width: 200
                }, {
                    field: 'gsbx_insured_qf_month',
                    title: '工伤保险欠费月份',
                    align: 'center',
                    width: 200
                }
                ]
            ]
        });

        //表头工具栏事件
        table.on('toolbar(test)', function (obj) {
            var rszs_log_id = $("#rszs_log_id").val();
            if (obj.event === 'LAYTABLE_EXCEL') {
                var formSelect = form.val('barsearchform');
                formSelect.limit = 99999;
                $.ajax({
                    url: "/rszs/rszs/detail?rszs_log_id="+rszs_log_id,
                    data: formSelect,
                    success: function (res) {
                        table.exportFile('test', res.data, 'xls');
                    }
                });
                return;
            }
        });
    }
</script>
{/block}
<!-- /脚本 -->
